package com.yfore.jfinal.pdf.plugin;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;

public class Test {

	public static void main(String[] args) throws FileNotFoundException, PdfCreateException {
		File pdf = new File("D://test.pdf");
		OutputStream os = new FileOutputStream(pdf);
		File html = new File("D://e-policysheet.html");
        StringBuilder sb = new StringBuilder();   
        BufferedReader reader = new BufferedReader(new FileReader(html));   
        String line = null;   
        try {   
 
            while ((line = reader.readLine()) != null) {   
 
                sb.append(line);   
            }   
 
        } catch (IOException e) {   
 
            e.printStackTrace();   
 
        } finally {   
 
            try {   
 
            	reader.close();   
 
            } catch (IOException e) {   
 
                e.printStackTrace();   
 
            }   
 
        }
        String string = sb.toString().replaceAll("&nbsp;", " ");
		System.out.println(string);
//		String html = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><html><head><title>团体保险投保书</title></head><body><div align='center'>teststeet1</div><div>teststeet2</div><div>teststeet3</div></body></html>";
		PdfKit.createPdf(os, string);
	}
}
